<%--
  Created by IntelliJ IDEA.
  User: 云哥
  Date: 2023/6/3
  Time: 14:15
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>欢迎页面</title>
</head>
<body>
<h1>欢迎页面</h1>
<hr>
<%--test if(条件表达式==true/false)--%>
<c:if test="${not empty sessionScope.fullName}">
    欢迎${sessionScope.fullName}登录!
    <hr/>
   当前用户角色：
    <c:choose>
        <c:when test="${requestScope.userRole eq 1}">
            管理员登录
        </c:when>
        <c:when test="${requestScope.userRole eq 2}">
            VIP用户登录
        </c:when>
        <c:when test="${requestScope.userRole eq 3}">
            普通用户登录
        </c:when>
        <c:otherwise>
            游客登录
        </c:otherwise>
    </c:choose>
    <hr>

    <h2>用户列表</h2>
    <table border="1" width="80%">
        <tr>
            <td>用户编号</td>
            <td>用户姓名</td>
            <td>用户名</td>
            <td>用户性别</td>
        </tr>
            <%--var：变量名 --%>
            <%--items:数据源-集合--%>
        <c:forEach var="u" items="${requestScope.users}">
            <tr>
                <td>${u.userID}</td>
                <td>${u.fullName}</td>
                <td>${u.userName}</td>
                <td>${u.gender}</td>
            </tr>
        </c:forEach>
    </table>


</c:if>

<c:if test="${empty sessionScope.fullName}">
    <a href="login.jsp">马上去登录！</a>
</c:if>

</body>
</html>
